class Solution {
    public boolean isSubsequence(String s, String t) {
        int sLength = s.length();
        int tLength = t.length();
        if (sLength == 0) {
            return true;
        }
        int i = 0, j = 0;
        boolean[] dp = new boolean[sLength];
        while (i < sLength && j < tLength) {
            char s1 = s.charAt(i);
            char t1 = t.charAt(j);
            if (s1 == t1) {
                dp[i] = true;
                i++;
                j++;
            } else {
                j++;
            }
        }
        return dp[sLength - 1];

    }
}